extends VBoxContainer

var medal_texture = [preload("res://textures/UI/medalGold.png"), preload("res://textures/UI/medalSilver.png"),preload("res://textures/UI/medalBronze.png")]
var plane_texture = [preload("res://textures/Planes/planeBlue1.png"), preload("res://textures/Planes/planeGreen1.png"), preload("res://textures/Planes/planeRed1.png"), preload("res://textures/Planes/planeYellow1.png"), preload("res://textures/UI/medalBronze.png")]
@onready var h_box_containers = [$HBoxContainer, $HBoxContainer2, $HBoxContainer3]

func reflesh_data():
	var data = Global.rank_data["players_score"]
	for i in range(0,3):
		if i >= data.size():
			h_box_containers[i].hide()
			return
		h_box_containers[i].get_child(0).set_texture(medal_texture[i])
		h_box_containers[i].get_child(1).set_texture(plane_texture[data[i]["plane_type"]])
		h_box_containers[i].get_child(2).set_text(str(data[i]["score"]))
		h_box_containers[i].get_child(3).set_text(str(data[i]["time"]))
	pass
